package org.jeecg.chase.modules.merch.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.chase.modules.merch.entity.AdhMerchInfo;

/**
 * @Description: 商家管理
 * @Author: jeecg-boot
 * @Date:   2022-02-10
 * @Version: V1.0
 */
public interface AdhMerchInfoMapper extends BaseMapper<AdhMerchInfo> {
    @Select(" SELECT adh_merch_info.* FROM adh_merch_user LEFT JOIN adh_merch_info ON adh_merch_info.id = adh_merch_user.merch_id\n" +
            " WHERE adh_merch_user.user_phone = #{phoneNumber} ")
    public List<AdhMerchInfo> getMerchInfoByPhoneNumber(@Param("phoneNumber") String phoneNumber);

    @Select(" SELECT adh_merch_info.* FROM adh_user_merch_focus LEFT JOIN adh_merch_info\n" +
            " ON adh_user_merch_focus.merch_id = adh_merch_info.id WHERE adh_user_merch_focus.merch_id=#{merchId} AND adh_user_merch_focus.`user_id`=#{userId}")
    public List<Map<String,Object>> getFocusMerchInfoByUserIdAndMerchId(@Param("merchId") String merchId,@Param("userId") String userId);

    @Select(" SELECT adh_merch_info.* FROM adh_user_merch_focus LEFT JOIN adh_merch_info\n" +
            " ON adh_user_merch_focus.merch_id = adh_merch_info.id WHERE adh_user_merch_focus.`user_id`=#{userId}")
    public List<Map<String,Object>> getFocusMerchInfoByUserId(@Param("userId") String userId);

}
